#pragma once

#include <future>
#include <mutex>
#include "json.h"
#include "HidDevice.h"




class TailDevice:public HidDevice{
public:
    TailDevice(const std::string& device_path, std::string& product_model, const std::string& product_name, const std::string& phy_version, 
        const std::string& soft_version, const std::string& serial_number, 
        const std::string& unique_id, std::vector<HidDevInfo> sub_devices);
    ~TailDevice() override;



    bool Upgrade(const std::string& file_path) override;

private:
    bool SendMatchTailMessage();

    bool getApChannel(std::string filename, int &channel);

    bool SendMesage(Json::Value table);
    
    bool SpliceTailMatchMessage(Json::Value &table);


    void deviceInfoRecv(uint16_t ctrl, uint16_t dst, uint16_t src, uint16_t version, 
            const uint8_t *payload, int bytes);


private:
    std::recursive_mutex m_mux;
};
